9 #define D(x) cout<<__LINE__ <<": " <<#x<<" es "<<x<<endl
11 const double pi
= acos(-1.0);
13 inline double toGrad(double a
){ return 180*a
/ pi
; }
17 point(){} point(double x
, double y
) : x(x
), y(y
) {}
18 const point
operator-(const point
&that
) const{
19 return point(this->x
- that
.x
, this->y
- that
.y
);
21 void print() const{printf("%lf %lf, inclination = %lf\n", x
, y
, toGrad(atan2(y
, x
)));}
25 Retorna el ángulo de inclinación del vector p, barrido
26 en sentido antihorario a partir del eje X positivo.
30 double r
= atan2(p
.y
, p
.x
);
31 if (r
< 0.0) r
+= 2*pi
;
35 double rotation(point a
, point b
, point c
){
36 //D( asin(((b.x-a.x)*(c.y-b.y)-(b.y-a.y)*(c.x-b.x))/(hypot(b.x-a.x,b.y-a.y)*hypot(c.x-b.x,c.y-b.y)))*180.0/pi);
37 double antes
= ccw(b
-a
), despues
= ccw(c
-b
);
39 if (despues
> antes
) giro
= despues
- antes
;
40 else if (antes
> despues
) giro
= 2*pi
- (antes
- despues
);
41 // a.print(),b.print(),c.print(), D(giro);
48 //assert(freopen("trobot.in", "r", stdin) != NULL);
50 while (cin
>> n
&& n
){
52 for(int i
=0;i
<n
&& scanf("%lf%lf",&p
[i
].x
,&p
[i
].y
)!=EOF
;++i
);
54 for(int i
=0; i
<n
;++i
)ans
+=rotation(p
[i
],p
[(i
+1)%n
],p
[(i
+2)%n
]);//, D(ans);
55 printf("%.0lf\n",ans
/(2*pi
));